package defectsim;

public class MaterialFactory {
	
	public enum MaterialName {
		Copper,
		Iron,
		Aluminum
	}
	
	public static Material createMaterial(MaterialName mName){
		switch(mName){
		case Copper:
			Material mat = new Material("Copper");
			mat.setBurgersVector(0.255);
			mat.setDampingCoefficient(5e-5);
			mat.setPoissonRatio(0.324);
			mat.setShearModulus(42);
			mat.setNucleationStress(0.004);
			mat.setNucleationTime(4e-6);
			mat.setSlipPlaneSpacing(500);
			// Interobstacle spacing is chosen as 100 nm from "Generation of dislocations during plastic deformation", U. Messerschmidt & M. Bartsch, 2003
			mat.setInterobstacleSpacing(100);
			mat.setCrystalSystem(Material.CrystalSystems.FCC);
			mat.setNumberOfSlipSystems(5);
			double[] slipSystems = new double[mat.getNumberOfSlipSystems()];
			slipSystems[0] = 45;
			slipSystems[1] = 0;
			slipSystems[2] = 90;
			slipSystems[3] = 88;
			slipSystems[4] = 65;
			mat.setSlipSystems(slipSystems);
			mat.setNumberOfActiveSlipSystems(1);
			return mat;
		}
		throw new IllegalArgumentException("The material name " + mName + " is not recognized.");
	}
}
